//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//  PlayerViewController.m
//  PokerHandUp
//
//  Created by psvn047 on 6/11/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#import "PlayerViewController.h"
#import "AppDelegate.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@interface PlayerViewController ()

@end
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@implementation PlayerViewController
@synthesize pInfo;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

-(void) updateInfo:(PlayerInfo*) playerInfo
{
    self.pInfo = playerInfo;
    ivAvatar.image = playerInfo.Avatar;
    lblName.text = playerInfo.Username;
    lblMoney.text = [NSString stringWithFormat: @"$%d",playerInfo.Money];
    lblLevel.text = [NSString stringWithFormat: @"Lvl %d",playerInfo.Level];
}
-(void) addMoney:(long) money
{
    pInfo.Money += money;
    lblMoney.text = [NSString stringWithFormat: @"$%d",pInfo.Money];
}
-(void) subMoney:(long) money
{
    pInfo.Money -= money;
    lblMoney.text = [NSString stringWithFormat: @"$%d",pInfo.Money];
}
-(void) updateLevel:(long) level
{
    
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    //ivAvatar.image = [[AppDelegate sharedController].avatarCollection randomAvatar].image;
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    self.pInfo = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
////////////////////////////////////////////////////////////////////////////////////////////////////////////////